package com.flurry.android;

import android.text.TextUtils;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.regex.Pattern;
import org.apache.http.client.utils.URIUtils;

public final class UriUtils
{
  private static final Pattern je = Pattern.compile("/");

  private static URI N(String paramString)
  {
    try
    {
      URI localURI = new URI(paramString);
      return localURI;
    }
    catch (URISyntaxException localURISyntaxException)
    {
    }
    return null;
  }

  private static URI b(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5)
  {
    try
    {
      URI localURI = new URI(paramString1, paramString2, paramString3, paramString4, paramString5);
      return localURI;
    }
    catch (URISyntaxException localURISyntaxException)
    {
    }
    return null;
  }

  public static String currentDir(String paramString)
  {
    if (TextUtils.isEmpty(paramString));
    URI localURI3;
    do
    {
      URI localURI2;
      do
      {
        URI localURI1;
        do
        {
          return paramString;
          localURI1 = N(paramString);
        }
        while (localURI1 == null);
        localURI2 = localURI1.normalize();
      }
      while (localURI2.isOpaque());
      localURI3 = URIUtils.resolve(localURI2, "./");
    }
    while (localURI3 == null);
    return localURI3.toString();
  }

  public static String relativize(String paramString1, String paramString2)
  {
    if ((TextUtils.isEmpty(paramString1)) || (TextUtils.isEmpty(paramString2)));
    String[] arrayOfString1;
    int i;
    int j;
    int k;
    Object localObject1;
    Object localObject2;
    StringBuilder localStringBuilder;
    boolean bool1;
    URI localURI5;
    do
    {
      URI localURI2;
      URI localURI4;
      String str3;
      String str4;
      do
      {
        String str1;
        String str2;
        do
        {
          do
          {
            URI localURI3;
            do
            {
              URI localURI1;
              do
              {
                return paramString1;
                localURI1 = N(paramString1);
              }
              while (localURI1 == null);
              localURI2 = localURI1.normalize();
              localURI3 = N(paramString2);
            }
            while (localURI3 == null);
            localURI4 = localURI3.normalize();
          }
          while ((localURI2.isOpaque()) || (localURI4.isOpaque()));
          str1 = localURI2.getScheme();
          str2 = localURI4.getScheme();
        }
        while (((str2 == null) && (str1 != null)) || ((str2 != null) && (!str2.equals(str1))));
        str3 = localURI2.getAuthority();
        str4 = localURI4.getAuthority();
      }
      while (((str4 == null) && (str3 != null)) || ((str4 != null) && (!str4.equals(str3))));
      String str5 = localURI2.getPath();
      String str6 = localURI4.getPath();
      arrayOfString1 = je.split(str5, -1);
      String[] arrayOfString2 = je.split(str6, -1);
      i = arrayOfString1.length;
      j = arrayOfString2.length;
      for (k = 0; (k < j) && (k < i) && (arrayOfString1[k].equals(arrayOfString2[k])); k++);
      localObject1 = localURI2.getQuery();
      localObject2 = localURI2.getFragment();
      localStringBuilder = new StringBuilder();
      if ((k != j) || (k != i))
        break label389;
      String str7 = localURI4.getQuery();
      String str8 = localURI4.getFragment();
      bool1 = TextUtils.equals((CharSequence)localObject1, str7);
      boolean bool2 = TextUtils.equals((CharSequence)localObject2, str8);
      if ((!bool1) || (!bool2))
        break;
      localObject2 = null;
      localObject1 = null;
      localURI5 = b(null, null, localStringBuilder.toString(), (String)localObject1, (String)localObject2);
    }
    while (localURI5 == null);
    return localURI5.toString();
    if ((bool1) && (!TextUtils.isEmpty((CharSequence)localObject2)));
    for (Object localObject3 = null; ; localObject3 = localObject1)
    {
      if ((TextUtils.isEmpty((CharSequence)localObject3)) && (TextUtils.isEmpty((CharSequence)localObject2)))
        localStringBuilder.append(arrayOfString1[(i - 1)]);
      for (Object localObject4 = localObject2; ; localObject4 = localObject2)
      {
        localObject2 = localObject4;
        break;
        label389: int m = i - 1;
        int n = j - 1;
        for (int i1 = k; i1 < n; i1++)
        {
          localStringBuilder.append("..");
          localStringBuilder.append("/");
        }
        while (k < m)
        {
          localStringBuilder.append(arrayOfString1[k]);
          localStringBuilder.append("/");
          k++;
        }
        if (k < i)
          localStringBuilder.append(arrayOfString1[k]);
        if (localStringBuilder.length() != 0)
          break;
        localStringBuilder.append(".");
        localStringBuilder.append("/");
        break;
        localObject1 = localObject3;
      }
    }
  }

  public static String root(String paramString)
  {
    if (TextUtils.isEmpty(paramString));
    URI localURI3;
    do
    {
      URI localURI2;
      do
      {
        URI localURI1;
        do
        {
          return paramString;
          localURI1 = N(paramString);
        }
        while (localURI1 == null);
        localURI2 = localURI1.normalize();
      }
      while (localURI2.isOpaque());
      localURI3 = b(localURI2.getScheme(), localURI2.getAuthority(), "/", null, null);
    }
    while (localURI3 == null);
    return localURI3.toString();
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.UriUtils
 * JD-Core Version:    0.6.2
 */